package com.qf.entity.vo;


/**
 * @ClassName: RespType
 * @Description:
 * @Author: ytm1022
 */

public class RespType<T>{
    //状态值
    private int code;
    //失败提示信息
    private String msg;
    //成功传输的数据
    private T data;
    public enum CodeType{
        SUCCESS(200),FAIL(100),UNLOGIN(101),UNMGR(102),ERROE(404);
        private int value;
        CodeType(int value) {
            this.value=value;
        }

        public int getValue() {
            return value;
        }
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        RespType<?> respType = (RespType<?>) o;

        if (code != respType.code) return false;
        if (msg != null ? !msg.equals(respType.msg) : respType.msg != null) return false;
        return data != null ? data.equals(respType.data) : respType.data == null;
    }

    @Override
    public int hashCode() {
        int result = code;
        result = 31 * result + (msg != null ? msg.hashCode() : 0);
        result = 31 * result + (data != null ? data.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "RespType{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }
}
